using System;
using System.Collections.Generic;
using System.Drawing;

namespace PatternMaker
{
	public interface IPatternGenerator
	{
		/// <summary>
		/// Fired when the pattern generation is complete.
		/// </summary>
		event EventHandler Complete;

		/// <summary>
		/// Fired when an exception occurs during async pattern generation.
		/// </summary>
		event EventHandler<ExceptionEventArgs> ExceptionOccurred;

		/// <summary>
		/// Provides notification of the generation progress.
		/// </summary>
		event EventHandler<ProgressEventArgs> ProgressChanged;

		/// <summary>
		/// Fired when the generation process starts.
		/// </summary>
		event EventHandler Started;


		/// <summary>
		/// The horizontal cell count of the overlayed grid.
		/// </summary>
		int CellCountHorizontal
		{
			get;
			set;
		}

		/// <summary>
		/// The vertical cell count of the overlayed grid.
		/// </summary>
		int CellCountVertical
		{
			get;
			set;
		}

		/// <summary>
		/// The resulting colour chart.
		/// </summary>
		Bitmap ColourChart
		{
			get;
			set;
		}

		/// <summary>
		/// The codes used to represent the colours used in the pattern.
		/// </summary>
		Dictionary<int, char> ColourCodes
		{
			get;
			set;
		}

		/// <summary>
		/// The tolerance for merging similar colours.
		/// </summary>
		/// <remarks>A lower number will produce more colours in the end pattern.</remarks>
		int ColourTolerance
		{
			get;
			set;
		}

		/// <summary>
		/// The font to use to draw the pattern symbols.
		/// </summary>
		Font Font
		{
			get;
			set;
		}

		/// <summary>
		/// The original image to generate the pattern from.
		/// </summary>
		Bitmap Original
		{
			get;
			set;
		}

		/// <summary>
		/// A copy of the resulting pattern.
		/// </summary>
		Bitmap Pattern
		{
			get;
		}

		/// <summary>
		/// A copy of the resulting pattern thumbnail.
		/// </summary>
		Bitmap PatternThumbnail
		{
			get;
		}

		/// <summary>
		/// The scaling factor to use.
		/// </summary>
		int Scale
		{
			get;
			set;
		}


		/// <summary>
		/// Starts async generation of the pattern.
		/// </summary>
		void Begin();

		/// <summary>
		/// Cancels async generation of the pattern.
		/// </summary>
		void Cancel();

		/// <summary>
		/// Generates a gridded, scaled preview of the original image.
		/// </summary>
		void Preview();
	}
}
